package com.csdj.t301.vo;

import java.util.HashMap;
import java.util.Map;

/**
 * author:cloud
 * date:2021/3/18 0018
 **/
public class WebResult {

    //错误信息编号
    private int code;
    //错误信息
    private String msg;
    //数据
    private Map<String,Object> result;

    public WebResult(int code){
        this.code = code;
        this.msg = "";
        this.result = new HashMap<>();
    }

    public WebResult(int code,Object obj){
        this.code = code;
        this.msg = "";
        Map<String,Object> result  = new HashMap<>();
        result.put("data",obj);
        this.result = result;
    }
    public WebResult putData(String key,Object object){
        this.result.put(key,object);
        return this;
    }
    public WebResult putData(Object obj){
        this.result.put("data",obj);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getResult() {
        return result;
    }

    public void setResult(Map<String, Object> result) {
        this.result = result;
    }
}
